﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace thousandClear.Util.Extension
{
    public static class DateTimeExtension
    {
        public static int GetAge(this DateTime birthday)
        {
            DateTime today = DateTime.Now;

            int age = today.Year - birthday.Year;

            if (birthday > today.AddYears(-age))
                age--;

            return age;
        }
    }
}
